import Vue from 'vue';
import Vuex from 'vuex';
import axios from 'axios';

import { productGetters, manufacturerGetters } from './getters';
import { productMutations, cartMutations, manufacturerMutations, userMutations } from './mutations';
import { productActions, manufacturerActions } from './actions';
Vue.use(Vuex);


export default new Vuex.Store({
    strict: true,
    state: {
        // bought items
        cart: [],
        total_price: 0,
        // ajax loader
        showLoader: false,
        // selected product
        product: {},
        // all products
        products: [],
        // all manufacturers
        manufacturers: [],
        user: {},
        showLogin: true,
    },
    mutations: {
        ...productMutations,
        ...cartMutations,
        ...manufacturerMutations,
        ...userMutations,
    },
    actions: {
        ...productActions,
        ...manufacturerActions,
    },
    getters: {
        ...productGetters,
        ...manufacturerGetters,
    },
});